<?php

/* 
 * EachGo电商网站 新媒体
 * www.eachgo.cn
 */

namespace Home\Controller;
use Think\Controller;
class LuckyMoneyController extends Controller{
    public function addLuckyMoney(){
        $lucky=D('LuckyMoney');
        $data=array(
            'isGot'=>true,
            'time'=>date('Y-m-d h:i:s'),
            'number'=>3,
            'user_ID'=>2,
            'orderInfo_ID'=>2,
        );
        $result=$lucky->addLuckyMoney($data);
        var_dump($result);        
    }
    public function delLuckyMoney(){
        $lucky=D('LuckyMoney');
        $result=$lucky->deleteLuckyMoney(3);
        var_dump($result);
    }
    public function getAllLuckyMoney(){
        $lucky=D('LuckyMoney');
        $lucky->queryAll();
        //$result=$lucky->queryAll();
        //var_dump($result);
    }
    public function getAllMoney(){
        $lucky=D('LuckyMoney');
        $result=$lucky->sumAll(2);
        var_dump($result);
    }
    public function updateLuckyMoney(){
        $lucky=D('LuckyMoney');
        $data=array(
            'id'=>1,
            'isGot'=>false,
        );
        $result=$lucky->update($data);
        var_dump($result);
    }
    public function getLuckyMoney(){
        $lucky=D('LuckyMoney');
        $result=$lucky->queryByUserId(2);
        var_dump($result);
        $result=$lucky->isGot(2);
        var_dump($result);
        $result=$lucky->isUsed(2);
        var_dump($result);
    }
}